//
//  BrandsContentCollectionViewCell.m
//  quxiangtao
//
//  Created by xbmios on 2018/7/3.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "BrandsContentCollectionViewCell.h"

@interface BrandsContentCollectionViewCell ()

@property (strong, nonatomic) UIImageView *bgIV;
@property (strong, nonatomic) UIImageView *circleIV;
@property (strong, nonatomic) UILabel *nameL;
@property (strong, nonatomic) UILabel *desLabel;
//@property (strong, nonatomic) UILabel *numberL;

@end

@implementation BrandsContentCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self == [super initWithFrame:frame]) {
        
        [self.contentView addSubview:self.bgIV];
        [self.contentView addSubview:self.circleIV];
        [self.contentView addSubview:self.nameL];
        [self.contentView addSubview:self.desLabel];
//        [self.contentView addSubview:self.numberL];
        
    }
    
    return self;
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    __weak typeof(self) weakSelf = self;
    [self.bgIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.contentView.mas_left);
        make.right.mas_equalTo(weakSelf.contentView.mas_right);
        make.top.mas_equalTo(weakSelf.contentView.mas_top);
        make.height.mas_equalTo(jisuan(160));
        
    }];
    [self.circleIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(weakSelf.contentView.mas_centerX);
        make.top.mas_equalTo(weakSelf.bgIV.mas_bottom).with.offset(-jisuan(35));
        make.width.mas_equalTo(jisuan(70));
        make.height.mas_equalTo(jisuan(70));
        
    }];
    [self.nameL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(weakSelf.contentView.mas_centerX);
        make.top.mas_equalTo(weakSelf.circleIV.mas_bottom).with.offset(Margin);
        
    }];
    [self.desLabel sizeToFit];
    [self.desLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.contentView.mas_left);
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom).with.offset(-Margin);
        make.right.mas_equalTo(weakSelf.contentView.mas_right);
        
    }];
//    [self.numberL mas_makeConstraints:^(MASConstraintMaker *make) {
//
//        make.left.mas_equalTo(weakSelf.desLabel.mas_right);
//        make.centerY.mas_equalTo(weakSelf.desLabel.mas_centerY);
//        make.right.mas_equalTo(weakSelf.contentView.mas_right);
//    }];
    
}

#pragma mark -lazy
- (UIImageView *)bgIV {
    
    if (!_bgIV) {
        
        _bgIV = [[UIImageView alloc] init];
        _bgIV.backgroundColor = Colorf2f2f2;
        _bgIV.contentMode = UIViewContentModeScaleAspectFit;
        
    }
    
    return _bgIV;
}
- (UIImageView *)circleIV {
    
    if (!_circleIV) {
        
        _circleIV = [[UIImageView alloc] init];
        _circleIV.frame = CGRectMake(jisuan(50), jisuan(125), jisuan(70), jisuan(70));
        _circleIV.layer.cornerRadius = jisuan(35);
        _circleIV.layer.masksToBounds = YES;
        _circleIV.backgroundColor = Colorff2952;
        _circleIV.contentMode = UIViewContentModeScaleAspectFit;
        
    }
    
    return _circleIV;
}

- (UILabel *)nameL {
    
    if (!_nameL) {
        
        _nameL = [[UILabel alloc] init];
        _nameL.text = @"数码大牌";
        _nameL.textColor = Color333333;
        _nameL.font = Font(24);
        _nameL.textAlignment = NSTextAlignmentCenter;
    }
    
    return _nameL;
}

- (UILabel *)desLabel {
    
    if (!_desLabel) {
        
        _desLabel = [[UILabel alloc] init];
        _desLabel.text = @"iPhoneX低至6999";
        _desLabel.textColor = Color999999;
        _desLabel.font = Font(20);
        _desLabel.textAlignment = NSTextAlignmentLeft;
   
    }
    
    return _desLabel;

}

//- (UILabel *)numberL {
//
//    if (!_numberL) {
//
//        _numberL = [[UILabel alloc] init];
//        _numberL.textAlignment = NSTextAlignmentLeft;
//        _numberL.textColor = Colorff0000;
//        _numberL.text = @"6999";
//        _numberL.font = Font(20);
//
//    }
//
//    return _numberL;
//}


@end
